from django.contrib import admin

from .models import Post, Comment


# Register your models here.
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
    list_display = ['title', 'owner', 'status', 'created_time']

    fieldsets = (
        ('基本内容', {
            'description': '帖子基本信息',
            'fields': (
                'title',
                'desc',
                'status',
                'owner',
            )
        }),
        ('主体内容', {
            'description': '帖子主体内容',
            'fields': (
                'content',
            )
        }),
        ('可选内容', {
            'description': '帖子可选内容',
            'fields': (
                'visitor_count',
                'comment_count',
                'thumb_up_count',
                'thumbers',
            )
        })
    )


@admin.register(Comment)
class CommentAdmin(admin.ModelAdmin):
    list_display = ['post', 'owner', 'status', 'created_time']

    fieldsets = (
        ('基本内容', {
            'description': '评论基本内容',
            'fields': (
                'post',
                'owner',
                'status',
            )
        }),
        ('主体内容', {
            'description': '评论主体内容',
            'fields': (
                'content',
            )
        })
    )
